<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.12.4/jquery.js"></script>
    <title>13-jquery内容选择器</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            background-color: springgreen;
            margin-top: 5px;
        }
    </style>
    <script>
        $(function() {
            //empty 找到既没有文本内容 也没有子元素的指定元素
            var divs = $("div:empty");
            console.log(divs);
            //parent 找到有文本内容或者有子元素的指定元素
            var divs = $("div:parent");
            console.log(divs);

            // 查找文本内容包含1的
            var divs = $("div:contains('1')");
            console.log(divs);

            // 查找子元素包含span的
            var divs = $("div:has('span')");
            console.log(divs);
        });
    </script>

</head>

<body>
    <div></div>
    <div>1</div>
    <div>21</div>
    <div>3</div>
    <div><span></span></div>
    <div>
        <p></p>
    </div>
</body>

</html>